home *** CD-ROM | disk | FTP | other *** search
- property state, hooked, hookChan, culvertChan, centerVertList, rightVertList, horizList, demoMove, firstArrowChan, buttonData, sandboxChan, demoMoveList, animCounter, task, demoCounter, arrowChannel
- global gSimObject, gTruckObject, gLevelObject
-
- on birth me
- set state to 1
- set task to EMPTY
- set hooked to 0
- set culvertChan to 4
- set hookChan to 5
- set firstArrowChan to 7
- set sandboxChan to 27
- set centerVertList to [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1]
- set rightVertList to [1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1]
- set horizList to [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 1, 1, 1]
- set buttonData to [1: [0, 1, 1, 1], 2: [0, 1, 0, 0], 3: [1, 0, 0, 0], 4: [0, 0, 1, 1], 5: [1, 0, 0, 0]]
- set demoMoveList to ["right", "down", "up", "left", "down"]
- return me
- end
-
- on setup me
- puppetPalette(0)
- if the demoFlag of gSimObject <> 1 then
- add(gActorList, birth(script "Rollover Anim Button Class", "goMenu( gCulvertObject, me )", 27, 27, 5, "RCA-07VO01", "RCA-07RO01"))
- add(gActorList, birth(script "Rollover Anim Button Class", "help( gCulvertObject, me )", 28, 28, 11, EMPTY, "RCA-05RO02"))
- else
- set demoCounter to 0
- set task to "demo( me )"
- end if
- set state to 1
- set task to EMPTY
- set hooked to 0
- set the visible of sprite firstArrowChan to 0
- puppetSprite(hookChan, 1)
- puppetSprite(culvertChan, 1)
- add(gActorList, me)
- end
-
- on update me
- if task = EMPTY then
- if the demoFlag of gSimObject then
- Demo(me)
- end if
- else
- do(task)
- end if
- end
-
- on Demo me
- set demoCounter to demoCounter + 1
- set demoMove to getAt(demoMoveList, demoCounter)
- set arrowChannel to firstArrowChan + getPos(["up", "right", "down", "left"], demoMove) - 1
- set the castNum of sprite arrowChannel to the castNum of sprite arrowChannel + 1
- puppetSprite(arrowChannel, 1)
- set animCounter to 0
- puppetSound("arrowClick")
- updateStage()
- set task to "executeButton( me )"
- end
-
- on executeButton me
- if not soundBusy(1) then
- clearTask(me)
- set the castNum of sprite arrowChannel to the castNum of sprite arrowChannel - 1
- puppetSprite(arrowChannel, 0)
- set animCounter to 0
- puppetSound("1020machine")
- do(demoMove & "Button( me )")
- end if
- end
-
- on arrowButton me, direction
- set animCounter to 0
- buttonSound(me)
- hideOtherActors(me)
- do(direction & "Button( me )")
- end
-
- on upButton me
- if state = 3 then
- set task to "upCenter( me )"
- else
- if state = 5 then
- set task to "upRight( me )"
- end if
- end if
- end
-
- on upCenter me
- set animCounter to animCounter + 1
- if animCounter <= count(centerVertList) then
- moveVert(me, -1 * getAt(centerVertList, animCounter))
- else
- clearTask(me)
- set state to 1
- updateButtons(me)
- end if
- end
-
- on upRight me
- set animCounter to animCounter + 1
- if animCounter <= count(rightVertList) then
- moveVert(me, -1 * getAt(rightVertList, animCounter))
- else
- clearTask(me)
- set state to 4
- updateButtons(me)
- end if
- end
-
- on downButton me
- if state = 1 then
- set task to "downCenter( me )"
- else
- if state = 4 then
- set task to "downRight( me )"
- end if
- end if
- end
-
- on downCenter me
- set animCounter to animCounter + 1
- if animCounter <= count(centerVertList) then
- moveVert(me, getAt(centerVertList, animCounter))
- else
- clearTask(me)
- if hooked then
- bridgeDone(me)
- else
- set state to 3
- updateButtons(me)
- end if
- end if
- end
-
- on downRight me
- set animCounter to animCounter + 1
- if animCounter <= count(rightVertList) then
- moveVert(me, getAt(rightVertList, animCounter))
- else
- clearTask(me)
- set hooked to 1
- set state to 5
- updateButtons(me)
- end if
- end
-
- on rightButton me
- set task to "goRight( me )"
- end
-
- on goRight me
- set animCounter to animCounter + 1
- if animCounter <= count(horizList) then
- moveHoriz(me, getAt(horizList, animCounter))
- else
- clearTask(me)
- if state = 2 then
- set state to 1
- else
- if state = 1 then
- set state to 4
- end if
- end if
- updateButtons(me)
- end if
- end
-
- on leftButton me
- set task to "goLeft( me )"
- end
-
- on goLeft me
- set animCounter to animCounter + 1
- if animCounter <= count(horizList) then
- moveHoriz(me, -1 * getAt(horizList, animCounter))
- else
- clearTask(me)
- if state = 1 then
- set state to 2
- else
- if state = 4 then
- set state to 1
- end if
- end if
- updateButtons(me)
- end if
- end
-
- on moveVert me, delta
- set the locV of sprite hookChan to the locV of sprite hookChan + delta
- if hooked then
- set the locV of sprite culvertChan to the locV of sprite culvertChan + delta
- end if
- puppetTempo(40)
- end
-
- on moveHoriz me, delta
- set the locH of sprite hookChan to the locH of sprite hookChan + delta
- if hooked then
- set the locH of sprite culvertChan to the locH of sprite culvertChan + delta
- end if
- puppetTempo(40)
- end
-
- on clearTask me
- set animCounter to 0
- set task to EMPTY
- puppetSound(0)
- showAllActors()
- end
-
- on buttonSound me
- puppetSound("arrowClick")
- updateStage()
- finishSound(me)
- puppetSound("1020machine")
- end
-
- on finishSound me
- repeat while soundBusy(1)
- end repeat
- puppetSound(0)
- end
-
- on updateButtons me
- set buttonList to getProp(buttonData, state)
- repeat with button = 1 to count(buttonList)
- set boolean to getAt(buttonList, button)
- set the visible of sprite (firstArrowChan + button - 1) to boolean
- end repeat
- finishSound(me)
- end
-
- on bridgeDone me
- set state to 1
- set hooked to 0
- clearAllActors()
- finishSound(me)
- go("BridgeDone")
- puppetSprite(hookChan, 0)
- puppetSprite(culvertChan, 0)
- end
-
- on finished me
- repeat with button = 1 to 4
- set the visible of sprite (firstArrowChan + button - 1) to 1
- end repeat
- set x to blockCrossings(the cell of gTruckObject, getLast(the recordedMoveList of gSimObject))
- makeBridge(gTruckObject)
- keepSandboxBut(sandboxChan)
- puppetPalette("RiverPal")
- go("Grass")
- go(the frame + 1)
- puppetSprite(48, 0)
- puppetPalette("SimPal", 60)
- updateStage()
- puppetPalette(0)
- predrawSimButtons(gSimObject)
- go(label("Simulator" & string(the level of gLevelObject)))
- end
-
- on goMenu me, buttonObject
- forgetObstacle(gSimObject)
- set state to 1
- set hooked to 0
- clearAllActors()
- unpuppetAll()
- makeButtonJump(buttonObject)
- puppetSprite(48, 0)
- puppetPalette("RiverPal")
- go("Grass")
- go(the frame + 1)
- repeat with button = 1 to 4
- set the visible of sprite (firstArrowChan + button - 1) to 1
- end repeat
- unLoadCast()
- goLocationMap()
- end
-
- on help me, buttonObject
- birth(script "Help Parent", buttonObject, #Culvert)
- end
-
- on shortDelay me
- startTimer()
- repeat while the timer < 45
- end repeat
- end
-